<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%@page 
	contentType ="text/html; charset=windows-874" 
	import="java.util.Vector,
          java.util.StringTokenizer,
					com.softplus.carrefour.hd.bltier.admin.IMdStoreViewer,
					com.softplus.carrefour.hd.bltier.admin.MdStoreManage,
          com.softplus.carrefour.hd.bltier.admin.UserLevelManage,
          com.softplus.carrefour.hd.bltier.admin.UserOfficeHourManage,
					com.softplus.carrefour.hd.CFHDSystem,
					com.epro.standard.frontend.util.EproServletUtil,
					com.epro.standard.frontend.lov.EproLOV,
					com.epro.standard.frontend.lov.EproLOVColumn"
%>
<HTML>
<HEAD>
</HEAD>
	<%@taglib uri="/WEB-INF/HeadTag.tld"  prefix="header"%>
	<%@taglib uri="/WEB-INF/LovTag.tld"   prefix="lov"%>
<header:Head 
	author		=	"Pomme"
	title				="Insert"
	import		=""	   	
	jsFile			="../script/imgProp.js"
	styleFile	="../theme/LovTheme.css">
</header:Head>
<%
	java.util.Date startDate = new java.util.Date() ;
	String size = request.getParameter("size") == null ? "m" : request.getParameter("size") ;
  //String level = request.getParameter("level") == null ? "Select" : request.getParameter("level") ;
  System.out.println("POMME Level =");
//  Create Manager
	UserLevelManage ulManage = new UserLevelManage();

// Create datavector & Keywords.	
	EproServletUtil servletUtil = new EproServletUtil(request) ;
	//System.out.println("init with : " + (new java.util.Date().getTime() - startDate.getTime())/1000) ;
	
	String cNames[] = servletUtil.getRequestValues("searchColumnName") ;
	startDate = new java.util.Date() ;
	com.epro.standard.frontend.lov.LOVKeyword keyword = new com.epro.standard.frontend.lov.LOVKeyword() ;
//	Get search keyword.
	String searchKeyword = servletUtil.getRequestValue("searchKeyword") ;

	Vector checkBoxVec = new Vector();
	keyword.setMessage(searchKeyword);
	if(cNames != null)
		for(int i = 0 ; i < cNames.length ; i++)
    {
			checkBoxVec.add(com.epro.standard.frontend.util.StringUtil.stringTokenToArray(cNames[i])[0]) ;    
    }
	keyword.setCheckBox(checkBoxVec);

	// 1. Create LOV Object.
	EproLOV lov = new EproLOV() ;

	// 2. Adding columns.
	lov.addColumn(new EproLOVColumn("User ID", "left", 10, true)) ;
	lov.addColumn(new EproLOVColumn("User Name", "left", 50, true)) ;

// *********change to check not exist in LOV case selection continueing*******noom 	
	String selectedID 		= servletUtil.getRequestValue("selectedID");
  String countryID      = servletUtil.getRequestValue("countryID") ;
//  System.out.println("AAAAAAAAAAAAAAAAAAselectedIDPPP="+selectedID);
//  session.removeAttribute("sessionUserIdFromLOV");
//  if(!(selectedID.equals("No_User_Id")))
//  {  
//  session.setAttribute("sessionUserIdFromLOV",selectedID);  
//  }
//  
//  StringTokenizer st2 =new StringTokenizer(selectedID, ",")	;
//  String fin = "";  
//  int g=0;
//  while(st2.hasMoreElements())
//  {  g++;
//    String a = st2.nextToken();
//    fin = fin +"'"+ a+"'" + ",";    
//    System.out.println("111111111111="+g+"FINaaa = " + fin );
//  }   
//  System.out.println("FIN = " + fin);
//
//    fin=fin.substring(0,fin.lastIndexOf(","));
//    System.out.println("FIN = " + fin);
System.out.println("============================== selectedID =: |" + selectedID + "|") ;
  //if (!selectedID.trim().equals("") || !countryID.trim().equals(""))
  //{
    java.util.HashMap h = new java.util.HashMap() ;
    if (!selectedID.trim().equals(""))
      h.put("userIDs",selectedID) ;
    if ("L2Z,L3BKK,PROD".indexOf(servletUtil.getRequestValue("userLevel")) >= 0)
    {
      if (!countryID.trim().equals(""))
        h.put("countryID", countryID) ;
      else
      {
        UserOfficeHourManage uhm = new UserOfficeHourManage() ;
        String country = uhm.getMajorCountry() ;
        if ((country != null) && (country != ""))
          h.put("countryID", country) ;
      }
    }
    keyword.setCondition(h) ;
  //}
  
//  Vector selectedLov 			= new Vector() ;
//  StringTokenizer st=new StringTokenizer(selectedID,",")	;
//  System.out.println("st.nextToken()="+st.nextToken());
//    while(st.hasMoreElements())
//    {//System.out.println("st.nextToken()="+st.nextToken);
//    selectedLov.addElement(st.nextToken());
//    }
//***************************************************************************************

System.out.println("keyword with : " + (new java.util.Date().getTime() - startDate.getTime())/1000) ;
startDate = new java.util.Date() ;

   lov.addRow(ulManage.getLOVuserID(keyword));

	int	vectorSize = 0 ;

	vectorSize = lov.getBodyRows().size();
	System.out.println("getLOV with : " + (new java.util.Date().getTime() - startDate.getTime())/1000) ;
	startDate = new java.util.Date() ;

	boolean isMultiple = request.getParameter("isMultiple") != null ? request.getParameter("isMultiple").equalsIgnoreCase("true") : false ;

%>
<lov:lov  lovObj="<%=lov%>" reqObj="<%=request%>" isMultiple="<%=isMultiple%>"></lov:lov>
<%
System.out.println("send lov tag and end server page : " + (new java.util.Date().getTime() - startDate.getTime())/1000) ;
%>
